package com.changgou.goods.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.goods.pojo.Auditing;
import com.changgou.goods.service.AuditingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author Sherlock
 * @date 2020/3/31 下午 4:31
 */
@RestController
@CrossOrigin
@RequestMapping("/auditing")
public class AuditingController {

    @Autowired
    private AuditingService auditingService;

    /**
     * 通过商品Spu的Id查询该商品的审核记录
     * @param spuId 商品spu主键
     * @return
     */
    @GetMapping("/{spuId}")
    public Result<Auditing> findAuditingBySpuId(@PathVariable("spuId")String spuId){
        List<Auditing> auditingList = auditingService.findAuditingBySpuId(spuId);
        return new Result<>(true,StatusCode.OK,"查询审核记录成功",auditingList);
    }


}
